/*
 * Filename:    CaseRollBackController.java
 * Copyright:   2015 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2015-1-7
 */
package com.paic.mhis.hcpms.audit.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.paic.mhis.core.auth.biz.service.UserDetails;
import com.paic.mhis.hcpms.agreement.healthcareprovider.util.HttpProcessUtil;
import com.paic.mhis.hcpms.audit.biz.service.AuditManageRollBackService;
import com.paic.mhis.hcpms.audit.dto.AuditManageRollBackDTO;
import com.paic.pafa.appclient.annotation.BizServicesProxy;

/**
 * 稽核撤回控制层
 * 
 * @author EX-PANAN001
 * 
 */
@Controller
@RequestMapping("/auditManageRollBack/")
public class AuditManageRollBackController {

	@BizServicesProxy(beanName = "auditManageRollBackService")
	private AuditManageRollBackService auditManageRollBackService;

	@RequestMapping("executeCaseRollBack.do")
	@ResponseBody
	public Map<String, Object> executeCaseRollBack(@ModelAttribute
	AuditManageRollBackDTO rollbackDTO, HttpServletRequest request) {
		UserDetails user = (UserDetails) request.getSession().getAttribute(
				"user");
		Map<String, Object> result = new HashMap<String, Object>();
		AuditManageRollBackDTO executeRollBack;
		try {
			executeRollBack = auditManageRollBackService.executeRollBack(
					rollbackDTO, user);
			result.put("result", executeRollBack);
		} catch (Exception e) {
			e.printStackTrace();
			result = HttpProcessUtil.processException(e);
		}
		return result;
	}
}
